#topics-wrapper
  .topics-admin
    .well.well-lg.clearfix
      .col-md-2.col-xs-12
        a.btn.btn-success.btn-block.new(href='#{forum.url}/admin/topics/create')
          span.glyphicon.glyphicon-plus
          = ' ' + t('admin-topics.list.add-topic')
      .col-md-7.col-xs-12.text-center
        .input-group.input-group-md
          span.input-group-addon
            i.glyphicon.glyphicon-search
          input.form-control.search(type='text', placeholder='#{t("admin-topics.list.search.placeholder")}', autofocus)
      .col-md-3.col-xs-12.text-center
        .btn-group
          span.sort-label.pull-left=t('admin-topics.list.sort')
          button.btn.btn-primary.sort(data-sort='topic-date')
            span.glyphicon.glyphicon-time
          button.btn.btn-primary.sort(data-sort='topic-title')
            span.glyphicon.glyphicon-font
    .list.list-group.col-xs-12
      - each topic in topics
        a.list-group-item(href="#{forum.url}/admin/topics/" + topic.id, data-topicid=topic.id)
          button.btn.btn-default.pull-right.delete-topic
            span.glyphicon.glyphicon-trash
          h4.topic-title=topic.mediaTitle
            small=topic.topicId
          - if (topic.author)
            span.glyphicon.glyphicon-user
            span.text=topic.author
          span.glyphicon.glyphicon-time
          - if (topic.closingAt)
            - var date = new Date(topic.closingAt)
            - var relative = moment(date).fromNow()
            - var when = (date < Date.now()) ? 'past' : 'future'
            span.text=t('admin-topics.list.close.' + when) + ' ' + relative
          - else
            span.text=t('article.unknown-closing-date')
          span.glyphicon.glyphicon-tag
          span.text.topic-id=topic.tag.name
          span.topic-date.hide=topic.createdAt
